<?php

require_once 'MagicBean.php';

class Request extends MagicBean{
	
	
	public function __construct($req = array(), $trim = false) {
		foreach ($req as $k => $v) {
			$this->params[$k] = $v;
		}
		
		if ($trim) {
			array_walk_recursive($this->params, "trimByRef");
		}
	}
	
	function set ($name, $value) {
	
		$this->params[$name] = $value;
	
	}
	
	public function get($name) {
	
		if (isset($this->params[$name])) {
			return $this->params[$name];
		}
	
		return '';
	}
	
	public function getParams() {
		return $this->params;
	}
	
	public function unsetParam($name) {
		if (isset($this->params[$name])) {
			unset($this->params[$name]);
		}
	}
	
}